namespace OracleInternal.Json.Sql
{
	internal class OracleJsonDouble : OracleJsonNumber
	{
		internal static string NAN = "\"Nan\"";

		private double m_value;

		internal OracleJsonDouble(double value)
		{
			m_value = value;
		}

		public override OracleJsonType GetOracleJsonType()
		{
			return OracleJsonType.DOUBLE;
		}

		internal override decimal BigDecimalValue()
		{
			return (decimal)m_value;
		}

		internal override double DoubleValue()
		{
			return m_value;
		}

		internal override string GetJsonString()
		{
			if (double.IsPositiveInfinity(m_value))
			{
				return OracleJsonDecimal.POSITIVE_INF;
			}
			if (double.IsNegativeInfinity(m_value))
			{
				return OracleJsonDecimal.NEGATIVE_INF;
			}
			if (double.IsNaN(m_value))
			{
				return NAN;
			}
			return m_value.ToString();
		}

		internal OracleJsonDouble GetDOUBLE()
		{
			return new OracleJsonDouble(m_value);
		}
	}
}
